﻿using BCEntity.OA.WorkflowActive.WorkflowActivityStepSpecificFormItem;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BCData.OA.WorkflowActivity.WorkflowActivityStepSpecificFormItem
{
	/// <summary>
	/// 工作流活动特殊表单项
	/// </summary>
	public interface IWorkflowActivityStepSpecificFormItemData
	{
		#region  成员方法
		/// <summary>
		/// 是否存在该记录
		/// </summary>
		/// <param name="workflowActivityStepSpecificFormItemId">工作流活动特殊表单项Id</param>
		Task<bool> Exists(long workflowActivityStepSpecificFormItemId);
		/// <summary>
		/// 增加工作流活动特殊表单项
		/// </summary>
		/// <param name="entity">工作流活动特殊表单项信息</param>
		Task<WorkflowActivityStepSpecificFormItemEntity> Add(WorkflowActivityStepSpecificFormItemEntity entity);
		/// <summary>
		/// 更新工作流活动特殊表单项
		/// </summary>
		/// <param name="entity">工作流活动特殊表单项信息</param>
		Task<WorkflowActivityStepSpecificFormItemEntity> Update(WorkflowActivityStepSpecificFormItemEntity entity);
		/// <summary>
		/// 删除工作流活动特殊表单项
		/// </summary>
		/// <param name="workflowActivityStepSpecificFormItemId">工作流活动特殊表单项Id</param>
		Task<bool> Delete(long workflowActivityStepSpecificFormItemId);
		/// <summary>
		/// 获取工作流活动特殊表单项
		/// </summary>
		/// <param name="workflowActivityStepSpecificFormItemId">工作流活动特殊表单项Id</param>
		Task<WorkflowActivityStepSpecificFormItemEntity> GetEntity(long workflowActivityStepSpecificFormItemId);
		/// <summary>
		/// 获取工作流活动特殊表单项列表
		/// </summary>
		/// <param name="workflowActivityId">工作流活动Id</param>
		Task<IEnumerable<WorkflowActivityStepSpecificFormItemEntity>> GetList(long workflowActivityId);
		/// <summary>
		/// 获取工作流活动特殊表单项分页列表
		/// </summary>
		/// <param name="start">开始时间</param>
		/// <param name="end">结束时间</param>
		/// <param name="sortName">排序字段</param>
		/// <param name="ascending">升序</param>
		/// <param name="pageIndex">当前页码</param>
		/// <param name="pageSize">每页数据条数</param>
		Task<(IEnumerable<WorkflowActivityStepSpecificFormItemEntity>, int)> Query(DateTime? start, DateTime? end, string sortName, bool? ascending, int pageIndex, int pageSize);
		#endregion  成员方法

		/// <summary>
		/// 特殊表单数据写入对应表
		/// </summary>
		/// <param name="tableName">表名称</param>
		/// <param name="keyValuePairs">对应字段及值</param>
		/// <returns></returns>
		Task<long> InsertSpecificFormTable(string tableName, Dictionary<string, string> keyValuePairs);

		/// <summary>
		/// 更新特殊表单数据处理已执行
		/// </summary>
		/// <param name="workflowActivityId">工作流活动Id</param>
		/// <param name="tableName">表名称</param>
		/// <param name="formConfigRows">表单行号</param>
		/// <param name="formItemRows">表单项行号</param>
		/// <returns></returns>
		Task<int> UpdateSpecificFormIsExecution(long workflowActivityId, string tableName, int? formConfigRows, int? formItemRows);

		/// <summary>
		/// 特殊表单数据更新对应表
		/// </summary>
		/// <param name="tableName">表名称</param>
		/// <param name="keyValuePairs">更新对应字段及值</param>
		/// <param name="updateKeyValuePairs">检索键对应字段及值</param>
		/// <returns></returns>
		Task<int> UpdateSpecificFormTable(string tableName, Dictionary<string, string> keyValuePairs, Dictionary<string, string> updateKeyValuePairs);
    }

}
